import 'package:favoritecate/ui/pages/detail/meal_detail.dart';
import 'package:favoritecate/ui/pages/filter/filter_page.dart';
import 'package:favoritecate/ui/pages/meal/meal.dart';
import 'package:flutter/material.dart';
import 'package:favoritecate/ui/pages/main/main.dart';

class FYRouter{
  static final String initialRoute = FYMainPage.routeName;

  static final Map<String,WidgetBuilder> routers = {
    FYMainPage.routeName:(ctx) => FYMainPage(),
    FYMealPage.routeName:(ctx) => FYMealPage(),
    FYMealDetailPage.routeName:(ctx) => FYMealDetailPage(),
   };

  //路由中没有找到关于FYFilterPage,如果在路由中配置的话是push方式，没法实现从底部弹出
  static final RouteFactory generateRoute = (settings){
    if(settings.name == FYFilterPage.routeName){
      return MaterialPageRoute(
        builder: (ctx){
          return FYFilterPage();
        },
        fullscreenDialog: true
      );
    }
    return null;
  };

  static final RouteFactory unknowRoute = (settings){
    return null;
  };
}